# -*- coding: utf-8 -*-
# @Author: Wolf
# @Date:   2025-03-19 15:06:47
# @Last Modified by:   Wolf
# @Last Modified time: 2025-03-19 15:33:45


import pymysql
import pymysql.cursors


while True:
    user= input("用户名：")
    if user.upper() == 'Q':
        break
    pwd = input("密码：")
    mobile = input("手机号：")




    conn = pymysql.connect(host="192.168.1.215", port=3306, user='root', passwd="123456", charset='utf8',db="unicom")
    cursor = conn.cursor(cursor=pymysql.cursors.DictCursor)

    print("查询成功！")
    cursor.execute("select * from admin")
    data_list = cursor.fetchall()

    print(data_list)

    for data in data_list:
        print(data)

    # cursor.execute("insert into admin(username,password,mobile) values('admin','123456','12345678901')")

    sql = "insert into admin(username,password,mobile) values(%s,%s,%s)"
    cursor.execute(sql,[user,pwd,mobile])

    # sql = "insert into admin(username,password,mobile) values(%(n1)s,%(n2)s,%(n3)s)"
    # cursor.execute(sql,{'n1':'admin','n2':'123456','n3':'12345678901'})


    conn.commit()


    cursor.close()
    conn.close()




